<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/page/common/public.jspf"%>
<script type="text/javascript">
$(document).ready(function(){
	/**
	 * 查询投注记录
	 */
	var queryPlanList = new Helper.RemoteTrans({
		url: Helper.basePath + "/member_operate/userPlanList.htm",
		isAsync : false,
		onSuccess: function(result) {
			$("#IcurrentPage").val(result.returnObject);
			var resultList = result.returnValue;
			for ( var i = 0; i < resultList.length; i++) {
				var plan = resultList[i];
				var issueName = plan.issueName+'期';
				if(plan.issueName == '' || plan.issueName == null)
				{
					issueName = plan.typeText;
				}
				var xiangqing = "";
				if(plan.issueName == '' || plan.issueName == null)
				{
					issueName = plan.typeText;
				}
				if(plan.type == 'AGENCYBUY')
				{
					xiangqing = '<a class="blue" href="/lotteryDetail.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">查看详情</a>';
				}
				else if(plan.type == 'FOLLOWBUY')
				{
					xiangqing = '<a class="blue" href="/followDetail.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">查看详情</a>';
				}
				else if(plan.type == 'BUY306')
				{
					xiangqing = '<a class="blue" href="/autobetDetail306.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">查看详情</a>';
				}
				else
				{
					xiangqing = '';
				}
				//是否活动赠送
				var isActivity='';
				if(plan.betSource=='ACTIVITY'){
					isActivity="&nbsp;<span class='red'>赠</span>";
				}
				var text = '<li class="list_item"><div class="item_left ticket_logo"><img src="${skin }/images/logo_'+plan.gameCode+'_l.png" alt="">'
					+'<p et="tap:my.read-deal.tap">'+plan.gameName+'</p></div><div class="item_main ticket_detail">'
					+'<p class="ui_color_gray ui_font_S">'+issueName+isActivity+'</p><p><span class="ui_color_black ui_font_M">'+plan.betMoney+'元</span>'
					+'</p><p class="ui_color_gray ui_font_S s_12">'+plan.createTimeText+'</p></div>'
					+'<div class="item_more ticket_more" style="text-align: right;"><p class="ui_color_gray ui_font_S">'+plan.typeText+'</p>'
					+'<p class="ui_font_M">'+plan.statusText+'</p><a href="/lotteryDetail.htm?gameId='+plan.gameId+'&planId='+plan.planId+'" class="blue"><p class="ui_color_gray">'+xiangqing+'</p></a>'
					+'</div></li>';
				$('#planList_tbody').append(text);
			}
		}
	});
	
	queryPlanList.addParameters("currentPages", ($("#IcurrentPage").val()*1));
	queryPlanList.addParameters("pageSizes", 5);
	queryPlanList.send();
	
	/**
	 * 查询中奖记录
	 */
	var queryPlanbonusList = new Helper.RemoteTrans({
		url: Helper.basePath + "/member_operate/userPlanList.htm",
		isAsync : false,
		params:{isWin:'YES'},
		onSuccess: function(result) {
			$("#IcurrentPage").val(result.returnObject);
			var resultList = result.returnValue;
			for ( var i = 0; i < resultList.length; i++) {
				var plan = resultList[i];
				var issueName = plan.issueName+'期';
				var xiangqing = "";
				if(plan.issueName == '' || plan.issueName == null)
				{
					issueName = plan.typeText;
				}
				if(plan.type == 'AGENCYBUY')
				{
					xiangqing = '<a class="blue" href="/lotteryDetail.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">详情</a>';
				}
				else if(plan.type == 'FOLLOWBUY')
				{
					xiangqing = '<a class="blue" href="/followDetail.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">详情</a>';
				}
				else if(plan.type == 'BUY306'){
					xiangqing = '<a class="blue" href="/autobetDetail306.htm?gameId='+plan.gameId+'&planId='+plan.planId+'">详情</a>';
				}
				else
				{
					xiangqing = '';
				}
				//是否活动赠送
				var isActivity='';
				if(plan.betSource=='ACTIVITY'){
					isActivity="&nbsp;<span class='red'>赠</span>";
				}
				var text = '<tr><td>'+plan.gameName+'</td><td>'+issueName+isActivity+'</td><td><span class="red">'+plan.prizeMoney+'元</span></td><td>'+xiangqing+'</td></tr>';
				$('#bonusList_tbody').append(text);
			}
		}
	});
	
	/**
	 * 查看更多
	 */
	$('#querymore').click(function (){
		var lang = $('#selectDiv div[class="tab_item active"]').attr("lang");
		if(lang == 'bonusList_tbody')
		{
			queryPlanbonusList.addParameters("currentPages", ($("#IcurrentPage").val()*1)+1);
			queryPlanbonusList.addParameters("pageSizes", 5);
			queryPlanbonusList.send();
		}
		else
		{
			queryPlanList.addParameters("currentPages", ($("#IcurrentPage").val()*1)+1);
			queryPlanList.addParameters("pageSizes", 5);
			queryPlanList.send();
		}
	});
	
	$('#selectDiv div').click(function(){
		var lang = $(this).attr("lang");
		$('#selectDiv div').attr("class", "tab_item");
		$(this).attr("class", "tab_item active");
		if(lang == 'bonusList_tbody')
		{
			$('#'+lang).show();
			$('#'+lang).html('');
			$('#IcurrentPage').val(1);
			$('#planList_tbody').hide();
			$('#bonusList_tbody').append("<tr><td>玩法</td><td>期号</td><td>中奖金额</td><td>详情</td></tr>");
			queryPlanbonusList.addParameters("currentPages", ($("#IcurrentPage").val()*1));
			queryPlanbonusList.addParameters("pageSizes", 5);
			queryPlanbonusList.send();
		}
		else
		{
			$('#'+lang).show();
			$('#'+lang).html('');
			$('#IcurrentPage').val(1);
			$('#bonusList_tbody').hide();
			queryPlanList.addParameters("currentPages", ($("#IcurrentPage").val()*1));
			queryPlanList.addParameters("pageSizes", 5);
			queryPlanList.send();
		}
	});
});
</script>

<input type="hidden" id="IcurrentPage" value="1"/>
<div class="kj_content">
	<div class="tz_title center s_16">我的彩票</div>
	<div>
		<div class="fn_profile pd_10">
			<p>
				您好，&nbsp;<span>${memberInfo.betCardNo }</span>&nbsp;&nbsp;<a
					href="/page/memberinfo/sub/memberInfo.jsp" class="blue">个人资料&gt;&gt;</a></p>
			<p><span class="ml_10 l"><a
					href="${path }/memberCenter/member_operate/message.htm"><i class="qb_icon icon_letter"
						style="vertical-align: -2px; margin-right: 3px;"></i> </a> </span>
						<a class="l mr_10" href="javaScript:void(0);" onclick="javascript:window.location.reload()"><i class="ui_icon icon_refresh ml_5"></i></a>
						<!-- <c:if test="${storeId != '1020'}">
						<div class="chongzhi_bg2 center l"><a href="${path}/page/huodong/sanchongli/choujiang.jsp">充值满20元可抽奖一次</a></div>
						</c:if> -->
						<div class="clr"></div>
			</p>
			<p class="pt_5">
				余额：<span class="red"><fmt:formatNumber
						value="${(account.baseMoney+account.bonusMoney+account.presentMoney)/100 }"
						pattern="￥#,##0.00" />元</span>&nbsp;<a href="/page/memberinfo/money/accountLogList.jsp" class="blue">明细&gt;&gt;</a>&nbsp;
						<c:if test="${storeId != '1020'}">
						<a class="ui_btn ui_btn_blue  mr_5" href="/page/memberinfo/money/payment.jsp">充值</a>
						</c:if>
					<a class="ui_btn" href="${page }/memberCenter/member_operate/withdrawApply.htm">提款</a>
					<a class="ui_btn" href="/loginout.htm">退出</a>
			</p>
			<p class="pt_5">
				<a class="ui_btn mr_5" href="${path }/memberCenter/member_operate/searchBankCard.htm">绑定银行卡</a>
				<%-- <a class="ui_btn" href="${page }/member_operate/goUpdatePayPwd.htm">设置/修改密码</a> --%>
				<a class="ui_btn" href="${page }/page/memberinfo/sub/pwd_update.jsp">修改密码</a>
			</p>
			<div class="ui_color_link">
				<div id="ad-box-gc" class="ui_none"></div>
			</div>
		</div>
		<div class="ui_tab ui_border_t">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" id="selectDiv">
				<tr>
					<td width="50%">
						<div class="tab_item active" index="0" pe="click:my.record-menu.tap" lang="planList_tbody">
							投注记录
<!-- 							<label class="ui_select" for="my_lottery_select_lotteryId"> -->
<!-- 								<select id="my_lottery_select_lotteryId" name="my_lottery_select_lotteryId"> -->
<!-- 									<option value="">全部</option> -->
<!-- 									<option value="SSQ">双色球</option> -->
<!-- 									<option value="DLT">大乐透</option> -->
<!-- 									<option value="SD">福彩3D</option> -->
<!-- 								</select>  -->
<!-- 							</label> -->
						</div>
					</td>
					<td width="50%">
						<div class="tab_item" index="1" pe="click:my.record-menu.tap" lang="bonusList_tbody">
							中奖记录
						</div>
					</td>
				</tr>
			</table>
		</div>
		<ul class="fn_ticketlist ui_border_t_none ui_list ui_list_noarrow pd_20" style="display: none;">
			<div class="fn_noticket">
				<p class="center s_14">您目前还没有记录哦，赶紧买注试试手气吧~</p>
			</div>
		</ul>
		<ul class="fn_ticketlist ui_border_t_none ui_list ui_list_noarrow" id="planList_tbody"></ul>
		<ul class="fn_ticketlist ui_border_t_none ui_list ui_list_noarrow">
		<div class="fn_noticket">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="bonusList_tbody">
		</table>
</div>
		</ul>
		<div class="ui_bar qb_tac" id="querymore"
			pe="click:my.record-more.tap">
			<div class="qb_note qb_tac" id="record-more">查看更多</div>
		</div>
	</div>
</div>